
const Joi = require('joi')
// const Joi = require('@hapi/joi')

// 字符串、字母数字，最小3，最大10个字符，必填。
const username = Joi.string().alphanum().min(3).max(12).required()
const password =  Joi.string().pattern(/^[\S]{3,15}$/).required();
const rePassword = Joi.ref('password');
// 定义注册验证规则
exports.reg_log_schema = {
    body: {
        username,
        password
    }
}

const id = Joi.required();
const email = Joi.string().email().required();
const nickname = Joi.string().min(1).max(12).required();
exports.userInfoSchema = {
    body:{
        username,
        nickname,
        email,

    }
}


exports.resetPwdSchema = {
    body: {
        newPassword:password,
        oldPassword:password,
        rePassword:Joi.ref('newPassword'),

    }
}